package app.runner;

import java.util.Timer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import app.timer.MonitorTimer;
import app.utils.SysUtils;

@Component
public class ApplicationRunner implements CommandLineRunner {

	private static Logger logger = LoggerFactory.getLogger(ApplicationRunner.class);

	public void run(String... var1) throws Exception {
		logger.info("This will be execute when the project was started!");
		Timer timer = new Timer();
		// 10秒后开始执行，每分钟执行一次，可进行配置
		timer.schedule(new MonitorTimer(), SysUtils.MONITOR_TIMER_DELAY_TIME, SysUtils.MONITOR_TIMER_INTERVAL_TIME);
	}
}
